package main

import "fmt"

func main() {
	var num1 float64
	var num2 float64
	var optSymbol string
	fmt.Println("输入一个数")
	fmt.Scanln(&num1)
	fmt.Println("输入另一个数")
	fmt.Scanln(&num2)
	fmt.Println("输入运算符号")
	fmt.Scanln(&optSymbol)
	var result float64 = opt(num1, num2, optSymbol)
	fmt.Println(result)
}

func opt(num1, num2 float64, optSymbol string) float64 {

	if optSymbol == "+" {
		return num1 + num2
	} else if optSymbol == "-" {
		return num1 - num2
	} else if optSymbol == "*" {
		return num1 * num2
	} else if optSymbol == "/" {
		return num1 / num2
	} else {
		panic("请输入正确的运算符号")
	}

}
